package com.suitsoft.ut.service.base;

import com.suitsoft.ut.service.ServiceException;
import com.suitsoft.ut.util.ExcelTools;
import com.suitsoft.ut.util.StringUtils;

import jxl.Sheet;

/**
 * 学生Excel一列的数据
 *@author Suine
 */
public class ExcelDataStudent {
	/*** 学院 */
	private String college;
	/** 专业 */
	private String department;
	/** 班级 */
	private String classes;
	/*** 学生名 */
	private String name;
	/*** 学号 */
	private String no;
	/** 入学时间 */
	private String inSchool;
	/** 电话 */
	private String phone;
	/** e-mail */
	private String email;
	/** 备注 */
	private String memo;
	/** 年份 */
	private String year;
	
	public ExcelDataStudent(Sheet sheet,int i){
		String content = null;
		content = sheet.getCell(ExcelTools.COL_A,i).getContents();
		college = StringUtils.isEmpty(content) ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_B,i).getContents();
		department = StringUtils.isEmpty(content) ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_C,i).getContents();
		classes = StringUtils.isEmpty(content) ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_D,i).getContents();
		name = StringUtils.isEmpty(content) ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_E,i).getContents();
		no = StringUtils.isEmpty(content) ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_F,i).getContents();
		inSchool = StringUtils.isEmpty(content) ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_G,i).getContents();
		phone = StringUtils.isEmpty(content) ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_H,i).getContents();
		email = StringUtils.isEmpty(content) ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_I,i).getContents();
		memo = StringUtils.isEmpty(content) ? "" : content;
		
		content = sheet.getCell(ExcelTools.COL_J,i).getContents();
		year = StringUtils.isEmpty(content) ? "" : content;
		
		if(StringUtils.isEmpty(year) && StringUtils.isEmpty(classes) && StringUtils.isEmpty(inSchool) && StringUtils.isEmpty(college) && StringUtils.isEmpty(department) && StringUtils.isEmpty(email)
			&& StringUtils.isEmpty(memo) && StringUtils.isEmpty(name) && StringUtils.isEmpty(no) && StringUtils.isEmpty(phone)
		){
			throw new ServiceException("存在空行");
		}
	}
	public String getCollege() {
		return college;
	}
	public void setCollege(String college) {
		this.college = college;
	}
	public String getDepartment() {
		return department;
	}
	public void setDepartment(String department) {
		this.department = department;
	}
	public String getClasses() {
		return classes;
	}
	public void setClasses(String classes) {
		this.classes = classes;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getNo() {
		return no;
	}
	public void setNo(String no) {
		this.no = no;
	}
	public String getInSchool() {
		return inSchool;
	}
	public void setInSchool(String inSchool) {
		this.inSchool = inSchool;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((no == null) ? 0 : no.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ExcelDataStudent other = (ExcelDataStudent) obj;
		if (no == null) {
			if (other.no != null)
				return false;
		} else if (!no.equals(other.no))
			return false;
		return true;
	}
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}
}

